package com.guli.serviceoss.controller;

import com.guli.commonutils.R;
import com.guli.serviceoss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@CrossOrigin
@RequestMapping("/eduoss/file")
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping
    public R uploadAvatar(MultipartFile file){

        String url = ossService.uploadAvatar(file);

        return R.ok().data("url",url);
    }
}
